/**
 * 
 */

selectFilterData = new Object();

function selectFilter( selectId, filter )
{
	var list = document.getElementById(selectId);
	
	//if we don't have a list of all the options, cache them now'
	if(!selectFilterData[selectId])
	{
		selectFilterData[selectId] = new Array();
		for(var i = 0; i < list.options.length; i++)
		{
			selectFilterData[selectId][i] = list.options[i];
		}
	}
	
	//remove all elements from the list
	list.options.length = 0;
	
	//add elements from cache if they match filter
	for(var i = 0; i < selectFilterData[selectId].length; i++)
	{
		var o = selectFilterData[selectId][i];
		if(o.text.toLowerCase().indexOf(filter.toLowerCase()) >= 0)
		{
			list.add(o, null);
		}
	}
}
